#ifndef MAIN_H
#define MAIN_H

#include <stdio.h>
#include <lua.hpp>

extern lua_State* L;

void die(const char* fmt, ...);

void vid_init(int width, int height, bool fullscreen);
float vid_now();
bool vid_events();
void vid_clear();
void vid_flip();
void vid_fini();

void script_init();
void script_fini();
bool luaL_checkboolean(lua_State* L, int param);

int config_width();
int config_height();
int config_fullscreen();

void draw_infaxes();

void canvas_draw();
int l_Box(lua_State* L);
int l_Spider(lua_State* L);
int l_Spider_Move(lua_State* L);
int l_Spider_MoveLeg(lua_State* L);
int l_Spider_GetPos(lua_State* L);
int l_Spider_GetLegPos(lua_State* L);
int l_Spider_SetLegMode(lua_State* L);
int l_Spider_GetLegMode(lua_State* L);

extern float cam_yaw, cam_pit;
void camera_transform();
void camera_unrotate();
int l_Camera_SetPosition(lua_State* L);
int l_Camera_Move(lua_State* L);
int l_Camera_MoveRelative(lua_State* L);
int l_Camera_SetRotation(lua_State* L);
int l_Camera_Rotate(lua_State* L);
int l_Camera_GetRotation(lua_State* L);

int l_setvolume(lua_State* L);
int l_printoctree(lua_State*L);

int texture_load(const char* filename);

void snd_init();
void snd_fini();
int l_Sound_Tak(lua_State* L);

#endif

